import Vue from 'vue'
import Vuex from 'vuex'
import getters from './getters'
import app from './modules/app'
import settings from './modules/settings'
import user from './modules/user'
import routes from './modules/routes'
import persistedstate from 'vuex-persistedstate'
/*
  vuex数据持久化
     vuex-persistedstate
     1:下载  npm i  vuex-persistedstate
     2:导入 src/store/index.js中导入使用
        import persistedstate from 'vuex-persistedstate'
     3:配制使用插件
        plugins:[
            persistedstate({
              paths:['需要持久化的数据（模块名）','模块名.属性名']
            })  // 默认是所有的vuex数据持久化
        ]
*/

Vue.use(Vuex)

const store = new Vuex.Store({
  modules: {
    app,
    settings,
    user,
    routes
  },
  getters,
  plugins: [
    persistedstate({
      paths: ['user.token']
    })
  ]
})

export default store
